To understand the problem, let's go back to a simple example:
Code:
#include <stdio.h>
void foo(int x)
{
x = 123;
}
int main(void)
{
int y = 0;
foo(y);
printf("%d\n", y);
return 0;
}
As you probably can tell from reading the above code, the output of the above program is 0, not 123. The reason of course is that the assignment of 123 to x in foo only affects the local variable, not the variable from the caller. Now let's introduce a pointer:
Code:
#include <stdio.h>
void foo(int *x)
{
*x = 123;
}
int main(void)
{
int y = 0;
foo(&y);
printf("%d\n", y);
return 0;
}
Now, the output is indeed 123, because by assigning 123 to *x, what x points to, i.e., y, is modified. Let's go back to your code. As you may know, this:
Code:
void get_gene_name(char temp_line[])
is equivalent to:
Code:
void get_gene_name(char *temp_line)
So let's go back to the pointer example, but make it something like what you did in your code:
Code:
#include <stdio.h>
void foo(int *x, int *p)
{
x = p;
}
int main(void)
{
int y = 0;
int value = 123;
foo(&y, &value);
printf("%d\n", y);
return 0;
}
Once again, the output is 0 instead of 123. The reason brings us back to the first example: the assignment of p to x only affects the local variable, not the variable from the caller.